package com.legna.mhxy.support.service;

import com.legna.mhxy.support.dao.RingCategoryDao;
import com.legna.mhxy.support.dao.RingTypeDao;
import com.legna.mhxy.support.dao.UserRingDao;
import com.legna.mhxy.support.vo.UserRingVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
@Slf4j
@AllArgsConstructor
public class AnalysisService {
    private final RingCategoryDao ringCategoryDao;
    private final RingTypeDao ringTypeDao;
    private final UserRingDao userRingDao;


    /**
     * 查询用户小于3的环
     * @param userId
     * @return
     */
    public List<UserRingVO> analysisLess(Long userId,Integer less){
        List<UserRingVO> lessRing = new ArrayList<>();
        List<UserRingVO> vos = userRingDao.selectUserRingDetails(userId,null);
        for (UserRingVO vo : vos) {
            if (vo.getRingCount() < less){
                lessRing.add(vo);
            }
        }
        return lessRing;
    }
}
